package com.zzyl.nursing.controller.member;

import com.zzyl.common.core.domain.AjaxResult;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.nursing.domain.NursingProject;
import com.zzyl.nursing.dto.ServiceProjectDto;
import com.zzyl.nursing.service.ServiceProjectService;
import com.zzyl.nursing.service.impl.NursingProjectServiceImpl;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

import static com.zzyl.common.core.domain.AjaxResult.success;

@RestController
@RequestMapping("/member/orders")
@Tag(name = "服务项目管理")
public class ServiceProjectController {
    @Autowired
    private ServiceProjectService serviceProjectService;
    @Autowired
    private NursingProjectServiceImpl nursingProjectService;


    @GetMapping("/project/page")
    @Operation(description = "分页查询护理项目列表")
    public TableDataInfo<NursingProject> getProjectList(@RequestParam(required = false) Integer pageNum, @RequestParam(required = false) Integer pageSize, @RequestParam(required = false) String name, @RequestParam(required = false) Integer status) {
        TableDataInfo<NursingProject> nursingProjectTableDataInfo = nursingProjectService.pageByNameAndStatus(pageNum, pageSize, name, status);
//        TableDataInfo<NursingProject> projectList = serviceProjectService.getProjectList(pageNum, pageSize, name, status);
//        return AjaxResult.success(nursingProjectTableDataInfo);
        return nursingProjectTableDataInfo;
    }

    @GetMapping("/project/{id}")
    public AjaxResult getInfo(@PathVariable Integer id) {
        return AjaxResult.success(serviceProjectService.getById(id));
    }
}
